package Sort;

import java.util.Arrays;
import java.util.Random;

public class TestSort {

    public static void order(int[] array) {
        for(int i=0;i<array.length;i++) {
            array[i]=i;
        }
    }

    public static void notOrder(int[] array) {
        for(int i=0;i<array.length;i++) {
            array[i]= array.length-i;
        }
    }

    public static void randomOrder(int[] array) {
        Random random=new Random();
        for(int i=0;i<array.length;i++) {
            array[i]=random.nextInt(100000);
        }
    }

    public static void testInsertSort(int[] array) {
        array=Arrays.copyOf(array, array.length);
        long start=System.currentTimeMillis();
        Sort.insertSort(array);
        long end=System.currentTimeMillis();
        System.out.println("插入排序耗时："+(end-start)+"ms");
    }
    public static void testShellSort(int[] array) {
        array=Arrays.copyOf(array, array.length);
        long start=System.currentTimeMillis();
        Sort.shellSort(array);
        long end=System.currentTimeMillis();
        System.out.println("希尔排序耗时："+(end-start)+"ms");
    }

    public static void main2(String[] args) {
        int[] array=new int[10_0000];
        notOrder(array);
        testInsertSort(array);
        testShellSort(array);
    }

    public static void main(String[] args) {
        Sort sort=new Sort();
        int[] array={20,12,8,3,2,6};
        Sort.countSort(array);
        System.out.println(Arrays.toString(array));
    }
}
